package springdidemo.demos;


import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

@Component
public class BeanConfig {
    @Bean("u1")
//    @Primary
    public Student stu1(){
        return new Student("zhang",1);
    }

    @Bean("u2")
//    @Primary
    public Student stu2(){
        return new Student("lisi",2);
    }

    @Bean("n1")
    public String name(){
        return "a";
    }

    @Bean("n2")
    public String name2(){
        return "b";
    }

    /*
    @Primary
    @Bean("n3")
    public String name3(){
        return "c";
    }

    @Bean
    public Student stu3(@Qualifier("n2") String name){
        return new Student(name,33);
    }
*/




//@Bean("u3")
////@Bean
////如果和以上方法同名，会选同名的方法
//public Student stu3(@Qualifier("name2")String n){
//        return new Student(n,3);
//    }

}
